﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Cart>" %>

<asp:Content ID="Content3" ContentPlaceHolderID="JSContent" runat="server">
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <%: Html.Partial("Sidebar") %>
    <div id="main">
        <div class="main-block">
            <h2 class="title">
                <%:"Shopping Cart".Localize() %></h2>
            <div class="main-block-content cart-content clearfix">
                <div class="order-progress">
                    <ul>
                        <li class="active"><a>
                            <%:"Cart".Localize() %></a></li>
                        <li><a>
                            <%:"Address".Localize() %></a></li>
                        <li><a>
                            <%:"Shipping & Payment".Localize() %></a></li>
                        <li><a>
                            <%:"Confirm".Localize() %></a></li>
                    </ul>
                </div>
                <form action="<%: this.Url.Action("Index") %>" method="post">
                    <table>
                    <thead>
                        <tr>
                            <th>
                                <%: "Image".Localize() %>
                            </th>
                            <th>
                                <%: "Name".Localize() %>
                            </th>
                            <th>
                                <%: "SKU".Localize() %>
                            </th>
                            <th>
                                <%: "Unit Price".Localize() %>
                            </th>
                            <th>
                                <%: "Quantity".Localize() %>
                            </th>
                            <th>
                                <%: "SubTotal".Localize() %>
                            </th>
                            <th>
                                <%: "Discount".Localize() %>
                            </th>
                            <th>
                                <%: "Total".Localize() %>
                            </th>
                            <th>
                                <%: "Remove".Localize() %>
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        <% foreach (var item in (IEnumerable)this.ViewBag.CartItems)
                           {
                        %>
                        <tr>
                            <td>
                                <img src="<%= item.Bind("Image") %>" alt="" />
                            </td>
                            <td>
                                <input type="hidden" name="Id" value="<%: item.Bind("SaleItemId") %>" />

                                <a href="<%= item.Bind("ProductUrl") %>">
                                    <%= item.Bind("ProductName") %></a>
                            </td>
                            <td>
                                <%= item.Bind("Sku")%>
                            </td>
                            <td>
                                <%= item.Bind("UnitPrice") %>
                            </td>
                            <td class="quantity">
                                <input type="text" name="Id_<%: item.Bind("SaleItemId") %>_Quantity" value="<%= item.Bind("Quantity") %>"
                                    size="3" />
                            </td>
                            <td>
                                <%= item.Bind("SubTotal") %>
                            </td>
                            <td>
                                <%= item.Bind("Discount") %>
                            </td>
                            <td>
                                <%=  item.Bind("Total") %>
                            </td>
                            <td>
                                <a class="remove" href="<%= item.Bind("RemoveUrl") %>">
                                    <%:"Remove".Localize() %></a>
                            </td>
                        </tr>
                        <%
                           } %>
                           <tr>
                            <td colspan="9" style="text-align:right">
                                <%: "Make any changes above?".Localize() %>
                                    <input type="submit" value="<%:"Update".Localize() %>" />
                            </td>
                           </tr>
                    </tbody>
                </table>
                </form>
                <div class="total">
                    <dl>
                        <dt>
                            <%: "SubTotal:".Localize() %></dt>
                        <dd>
                            <%: this.Model.SubTotal.ToString("c") %></dd>
                    </dl>
                    <dl>
                        <dt>
                            <%: "Total Discount:".Localize() %></dt>
                        <dd>
                            <%: this.Model.TotalDiscount.ToString("c") %></dd>
                    </dl>
                    <dl>
                        <dt>
                            <%: "Total:".Localize() %></dt>
                        <dd>
                            <%: (this.Model.SubTotal - this.Model.TotalDiscount).ToString("C") %></dd>
                    </dl>
                </div>
                <div class="buttons">
                    <a class="button left" href="<%= this.ViewData["CartLinks"].Bind("Back") %>"><span>
                        <%:"« Continue Shopping".Localize() %></span></a>
                    <%
                        if (this.Model.Items.Count > 0)
                        {
                    %>
                    <a class="button right" href="<%= this.ViewData["CartLinks"].Bind("Checkout") %>"><span>
                        <%:"CheckOut »".Localize() %></span></a>
                    <%
                            } %>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#Coupon").change(function () {
                $(this).parent().parent().submit();
            });
        });
    
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Breadcrumb" runat="server">
    <ul class="breadcrumb">
        <li><a href="/">
            <%:"Home".Localize() %></a>&gt;</li>
        <li>
            <%:"Cart".Localize() %></li>
    </ul>
</asp:Content>
